﻿<UserControl x:Class="Peter.Sdw.View.StyleEditView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:icons="clr-namespace:Peter.Common.Icons;assembly=Peter.Common"
             xmlns:logic="clr-namespace:Peter.Sdw.Logic"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="800"
             d:DataContext="{d:DesignInstance logic:StyleModel}">

   <Grid>
      <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="Auto" />
         <RowDefinition Height="*" />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
         <ColumnDefinition Width="*" />
         <ColumnDefinition Width="*" />
         <ColumnDefinition Width="150" />
         <ColumnDefinition Width="*" />
      </Grid.ColumnDefinitions>

      <WrapPanel Grid.Row="0"
                 Grid.Column="0"
                 Grid.ColumnSpan="4"
                 Orientation="Horizontal">
         <Button ToolTip="Bold"
                 CommandParameter="strong"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="Bold"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Italic"
                 CommandParameter="em"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="Italic"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Blockquote"
                 CommandParameter="blockquote"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="Quote"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Ordered list"
                 CommandParameter="ol"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="Numberlist"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Unordered list"
                 CommandParameter="ul"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="Dotlist"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Small text"
                 CommandParameter="small"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="ResizeSmall"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Division"
                 CommandParameter="div"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="ThLarge"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Center align"
                 CommandParameter="calign"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="AlignCenter"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Right align"
                 CommandParameter="ralign"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="AlignRight"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Title"
                 CommandParameter="title"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="TextHeight"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Subtitle"
                 CommandParameter="subtitle"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="TextWidth"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
         <Button ToolTip="Summary"
                 CommandParameter="summary"
                 Command="{Binding Path=SetStyleCommand}">
            <icons:IconDisplay Icon="Textfield"
                               Margin="4,0"
                               IconSize="Small" />
         </Button>
      </WrapPanel>
      <TextBlock Text="Style Start"
                 Grid.Row="1"
                 Grid.Column="0" />
      <TextBox Grid.Row="2"
               Grid.Column="0"
               Margin="0,0,4,0"
               VerticalScrollBarVisibility="Auto"
               TextWrapping="WrapWithOverflow"
               VerticalAlignment="Stretch"
               AcceptsReturn="True"
               Text="{Binding Path=StartStyle}" />

      <TextBlock Text="Style End"
                 Grid.Row="1"
                 Grid.Column="1" />
      <TextBox Grid.Row="2"
               Grid.Column="1"
               VerticalScrollBarVisibility="Auto"
               TextWrapping="WrapWithOverflow"
               VerticalAlignment="Stretch"
               AcceptsReturn="True"
               Text="{Binding Path=EndStyle}" />

      <Grid Grid.Row="2"
            Margin="5,0"
            Grid.Column="2">
         <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
         </Grid.RowDefinitions>

         <CheckBox Grid.Row="0"
                   VerticalAlignment="Center"
                   Content="Spans Multiple entries"
                   IsChecked="{Binding Path=SpansMulitiple, Mode=TwoWay}"
                   Visibility="{Binding Path=CanSpan, Converter={StaticResource _BoolToVisi}}" />

         <Button Grid.Row="1"
                 CommandParameter="add"
                 Command="{Binding Path=StyleCommand}">
            <StackPanel Orientation="Horizontal">
               <icons:IconDisplay Icon="ChevronLeft" />
               <icons:IconDisplay Icon="PlusSign"
                                  Margin="4,0" />
               <TextBlock Text="Add Style" />
            </StackPanel>
         </Button>
         <Button Grid.Row="2"
                 CommandParameter="edit"
                 Command="{Binding Path=StyleCommand}">
            <StackPanel Orientation="Horizontal">
               <icons:IconDisplay Icon="Edit" />
               <TextBlock Text="Save Style"
                          Margin="4,0" />
               <icons:IconDisplay Icon="ChevronRight" />
            </StackPanel>
         </Button>
         <Button Grid.Row="3"
                 CommandParameter="delete"
                 Command="{Binding Path=StyleCommand}">
            <StackPanel Orientation="Horizontal">
               <icons:IconDisplay Icon="Remove" />
               <TextBlock Text="Delete Style"
                          Margin="4,0" />
               <icons:IconDisplay Icon="ChevronRight" />
            </StackPanel>
         </Button>
      </Grid>

      <TextBlock Grid.Row="1"
                 Grid.Column="3"
                 FontWeight="Bold"
                 Text="Current Styles" />

      <ListBox Grid.Row="2"
               Grid.Column="3"
               DisplayMemberPath="DisplayText"
               ItemsSource="{Binding Path=Styles}"
               SelectedItem="{Binding Path=SelectedStyle}" />

   </Grid>
</UserControl>
